package com.sinosoft.web.common;

import com.sinosoft.hydra.logging.LogModules;
import com.sinosoft.hydra.um.utils.AppUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;

/**
 * Created with IntelliJ IDEA.
 * User: xiaobo
 * Date: 13-9-26
 * Time: 下午1:51
 * To change this template use File | Settings | File Templates.
 */

/**
 * session监听器
 */
public class SessionBindListener implements HttpSessionBindingListener {
    private static final Logger log = LoggerFactory.getLogger(LogModules.STD_LOGGER);


    public void valueBound(HttpSessionBindingEvent event) {
        AppUtils.OnlineCounter.INSTANCE.login();
        log.debug("session Bound!");
    }

    public void valueUnbound(HttpSessionBindingEvent event) {
        AppUtils.OnlineCounter.INSTANCE.logout();
        log.debug("session unBound!");
    }
}
